package com.zlp.quartz.first;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringJoiner;

/**
 * @Author: zhulaiping
 * @Date: 2021/10/17 9:28
 */
public class HelloDataJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        StringJoiner joiner = new StringJoiner("-")
                .add("HelloDataJob execute")
                .add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()))
                .add(Thread.currentThread().getName())
                .add(context.getTrigger().getKey().getName());
        System.out.println(joiner);

        System.out.println("++++++++++++++++++++++"+context.getTrigger().getJobDataMap().get("key"));
        System.out.println("++++++++++++++++++++++"+context.getJobDetail().getJobDataMap().get("key"));
    }
}
